package me.magicall.db.sql.condition;

import me.magicall.db.sql.expression.Expression;

/**
 * 可以取反的条件
 * the expression that can use "not" such as "like","in"
 * 
 * @author MaGiCalL
 */
public class NegativableCondition extends OneCondition {

	private boolean not;

	public NegativableCondition(final Expression<?> firstArg, final OneConditionOperator operator, final Expression<?> secondArg, final boolean not) {
		super(firstArg, operator, secondArg);
		setNot(not);
	}

	public NegativableCondition(final Expression<?> firstArg, final OneConditionOperator operator, final Expression<?> secondArg) {
		super(firstArg, operator, secondArg);
	}

	protected NegativableCondition() {
		super();
	}

	public boolean getNot() {
		return not;
	}

	public void setNot(final boolean not) {
		this.not = not;
	}

	@Override
	public OneConditionOperator getOperator() {
		return getNot() ? super.getOperator().getNegativeOperator() : super.getOperator();
	}
}
